package com.nz.database.init;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @program: springboot
 * @description: 初始化 数据库 工具类
 * @author: 翁仕权
 * @create: 2020-06-06 16:27
 */
public class DbInit {
    private static final Logger logger = LoggerFactory.getLogger(DbInit.class);
    public static void main(String[] args) {
        /**
         -DDB_TYPE=mysql
         -DDB_DRIVER=com.mysql.cj.jdbc.Driver
         -DDB_METHOD=init
         -DDB_HOST_IP=localhost
         -DDB_PORT=3310
         -DDB_INSTANCE=phoenix
         -DDB_USER=root
         -DDB_PASSWORD=root
         -DDB_CONTINUE_ON_ERROR=false
         -DDB_DATA_SCOPE_ARRAY=
         -DDB_COMPANY=
         */

        logger.info("DB_METHOD={}", System.getProperty("DB_METHOD"));
        logger.info("DB_TYPE={}", System.getProperty("DB_TYPE"));
        logger.info("DB_DRIVER={}", System.getProperty("DB_DRIVER"));
        logger.info("DB_HOST_IP={}", System.getProperty("DB_HOST_IP"));
        logger.info("DB_PORT={}", System.getProperty("DB_PORT"));
        logger.info("DB_INSTANCE={}", System.getProperty("DB_INSTANCE"));
        logger.info("DB_USER={}", System.getProperty("DB_USER"));
        logger.info("DB_PASSWORD={}", System.getProperty("DB_PASSWORD"));
        logger.info("DB_CONTINUE_ON_ERROR={}", System.getProperty("DB_CONTINUE_ON_ERROR"));
        logger.info("DB_DATA_SCOPE_ARRAY={}", System.getProperty("DB_DATA_SCOPE_ARRAY"));
        logger.info("DB_COMPANY={}", System.getProperty("DB_COMPANY"));

        DbExecuteUtils.initDataBase( System.getProperty("DB_TYPE"),System.getProperty("DB_HOST_IP"),System.getProperty("DB_PORT"),
                System.getProperty("DB_INSTANCE"),System.getProperty("DB_USER"),System.getProperty("DB_PASSWORD"),System.getProperty("DB_DRIVER"),
                System.getProperty("DB_METHOD"),System.getProperty("DB_DATA_SCOPE_ARRAY"),System.getProperty("DB_CONTINUE_ON_ERROR"),
                System.getProperty("DB_COMPANY"));
    }
}
